package controllers;

import java.math.BigInteger;
import java.security.MessageDigest;

public class MD5Hash {

	public static String digest(String input) {
	
		String output;
		
		try{
				MessageDigest md = MessageDigest.getInstance("MD5");			
				byte[] outputBytes = md.digest(input.getBytes());
				BigInteger i = new BigInteger(1,outputBytes);			
				output = String.format("%1$032X", i);
		} catch (Exception e)
		{
			return null;
		}
		
		return output;	
	}
}